package cc.admin.modules.sys.util;

import javax.servlet.http.HttpServletRequest;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

/**
 * 将request中所有参数保存到map中
 *
 * @author: ZhangHouYing
 * @date: 2024/6/21
 */
public class ParameterToMap {
	public static Map<String, Object> getParametersToMap(HttpServletRequest request) {
		Map<String, Object> parameterMap = new HashMap<>();
		Enumeration<String> parameterNames = request.getParameterNames();
		while (parameterNames.hasMoreElements()) {
			String paramName = parameterNames.nextElement();
			String paramValue = request.getParameter(paramName);
			parameterMap.put(paramName, paramValue);
		}
		return parameterMap;
	}

}
